/* GUI CONVERTED from woopsch.p (converter v1.75) Sat Aug 12 16:37:11 2000 */
/* woopsch.p - Schedule work order operation record (wr_route)          */
/* Copyright 1986-2000 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*V8:ConvertMode=Maintenance                                            */
/*K1Q4*/ /*V8:WebEnabled=No                                             */
/* REVISION: 7.3     LAST MODIFIED: 07/25/96    BY: *G2C4* evan bishop  */
/* REVISION: 8.6     LAST MODIFIED: 05/20/98    BY: *K1Q4* Alfred Tan   */
/* REVISION: 9.1     LAST MODIFIED: 08/12/00    BY: *N0KC* myb          */


     {mfglobal.i}


     define input parameter work-site as character no-undo.
     define input parameter workctr-code as character no-undo.
     define input parameter machine-code as character no-undo.
     define input parameter load-hours as decimal no-undo.
     define input parameter sched-direction as integer no-undo.
     define input-output parameter workctr-cap as decimal no-undo.
     define input-output parameter operation-date as date no-undo.
     define output parameter sched-error like mfc_logical initial yes
         no-undo.

     define variable new-date as date no-undo.
     define variable new-wccap as decimal no-undo.

     assign new-date = operation-date
           new-wccap = workctr-cap.

     /* Apply time to capacity */
     if load-hours <> 0 then do:
     
     message 
     "work-site:" work-site "~r~n" 
     "workctr-code:" workctr-code "~r~n" 
     "machine-code:" machine-code "~r~n" 
     "load-hours:" load-hours "~r~n" 
     "sched-direction:" sched-direction "~r~n" 
     "workctr-cap:" workctr-cap "~r~n" 
     "operation-date:" operation-date "~r~n" 
     view-as alert-box.
     
        do while load-hours > new-w ccap:

           load-hours = load-hours - new-wccap.

           {gprun.i ""wccapnxt.p""
        "(work-site, workctr-code, machine-code,
          input-output new-date, sched-direction,
          output new-wccap, output sched-error)"}

           if sched-error then return.
        end.

        new-wccap = new-wccap - load-hours.
     end.

     assign sched-error = no
        workctr-cap = new-wccap
         operation-date = new-date.
